/*
题目：反转链表
给你单链表的头节点 head ，请你反转链表，并返回反转后的链表。
 */
public class ReverseList {
    public ListNode reverseList(ListNode head) {
        if (head == null || head.next == null)  return head;
        ListNode prev = null;
        ListNode cur = head;
        while (cur != null) {
            ListNode front = cur.next;
            cur.next = prev;
            prev = cur;
            cur = front;
        }
        return prev;
    }
}
